import React, {useEffect, useState} from "react";
import './parking_unit_data.scss'
import {Table} from "antd";
import {getOrgInfo} from "../../../api/orgApi";

function ParkingUnitData(){

    const [data, setData] = useState([])

    const columns = [
        {
            title: 'id',
            dataIndex: 'id',
            key: 'id',
        },
        {
            title: '所属区域',
            dataIndex: 'districtName',
            key: 'districtName',
        },
        {
            title: '单位名称',
            dataIndex: 'name',
            key: 'name',
        },
        {
            title: '所属单位',
            dataIndex: 'parentOrgName',
            key: 'parentOrgName',
        },
        {
            title: '状态',
            dataIndex: 'status',
            key: 'status',
        },
        {
            title: '联系人',
            dataIndex: 'contact',
            key: 'contact',
        },
        {
            title: '联系人电话',
            dataIndex: 'tel',
            key: 'tel',
        },
        {
            title: '地址',
            dataIndex: 'address',
            key: 'address',
        },
        {
            title: '备注',
            dataIndex: 'remark',
            key: 'remark',
        }
    ];

    useEffect(() => {
        getOrgData()
    }, []);

    const getOrgData = () => {
        getOrgInfo().then(res => {
            setData(res)
        })
    }


    return(
        <div className={'parking-unit-data-container'}>
            <Table dataSource={data} columns={columns}/>
        </div>
    )
}

export default ParkingUnitData